---
id: 657f465f8e718b19c5105ae5
title: ステップ 19
challengeType: 20
dashedName: step-19
---

# --description--

The final piece of the puzzle is the input string itself. The list comprehension needs to know about the object it'll iterate upon.

In this case, you need to iterate upon all the characters of the string.

```py
snake_cased_char_list = [
    '_' + char.lower() if char.isupper()
    else char
    for char in pascal_or_camel_cased_string
]
```

And there you have it. These three lines of code do the same task as the `for` loop you worked on previously while being cleaner and somewhat faster.

Add this last line of code to iterate over the characters of the string in your list comprehension and make sure that you're writing it within the pair of square braces.

# --hints--

You should add `for char in pascal_or_camel_cased_string` after `else char` within the square braces of `snake_cased_char_list`.

```js
({
    test: () => {
        const transformedCode = code.replace(/\r/g, "");
        const convert_to_snake_case = __helpers.python.getDef("\n" + transformedCode, "convert_to_snake_case");
        const { function_body } = convert_to_snake_case;

        assert.match(function_body, / +snake_cased_char_list\s*=\s*\[\s*'_'\s*\+\s*char\.lower\(\s*\)\s+if\s+char\.isupper\(\s*\)\s*else\s*char\s*for\s+char\s+in\s+pascal_or_camel_cased_string\s*\]/);
    }
})
```

# --seed--

## --seed-contents--

```py
def convert_to_snake_case(pascal_or_camel_cased_string):
    # snake_cased_char_list = []
    # for char in pascal_or_camel_cased_string:
    #     if char.isupper():
    #       converted_character = '_' + char.lower()
    #       snake_cased_char_list.append(converted_character)
    #     else:
    #         snake_cased_char_list.append(char)
    # snake_cased_string = ''.join(snake_cased_char_list)
    # clean_snake_cased_string = snake_cased_string.strip('_')

    # return clean_snake_cased_string

--fcc-editable-region--
    snake_cased_char_list = [
        '_' + char.lower() if char.isupper()
        else char

    ]
--fcc-editable-region--



def main():
    print(convert_to_snake_case('aLongAndComplexString'))

if __name__ == '__main__':
    main()
```
